package com.service.imp;

import com.entity.AddressList;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mapper.AddressListMapper;
import com.service.AddressListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.support.PagedListHolder;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class AddressListServiceImp implements AddressListService {

    @Autowired
    private AddressListMapper addressListMapper;
    @Override
    public PageInfo<AddressList> findAll(int pageNum){
        PageHelper.startPage(pageNum,4);
        List<AddressList> all = addressListMapper.findAll();
        PageInfo<AddressList> PageInfo = new PageInfo<>(all);
        return PageInfo;

    }
    @Override
    public void insert(String A_Name,String A_Phone,String A_Mail,String A_Relation){

        addressListMapper.insert(A_Name,A_Phone,A_Mail,A_Relation);
    }

    @Override
    public void delete(int a_id) {
        addressListMapper.delete(a_id);
    }
}
